using UnityEngine;

public class LookToCameraAxis : MonoBehaviour
{
    private Camera _mainCamera;
    // Start is called before the first frame update
    void Start()
    {
        _mainCamera ??= Camera.main;
    }

    // Update is called once per frame
    void Update()
    {
        if (!_mainCamera) return;
        //看向相机
        this.transform.LookAt(_mainCamera.transform.position);
        this.transform.localEulerAngles = new Vector3(_mainCamera.transform.eulerAngles.x,
            _mainCamera.transform.eulerAngles.y, this.transform.localEulerAngles.z);
    }
}
